import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/**
 * [lazy loading]
 */
const Home = resolve => require(['./views/Home'], resolve)  // 总客流量
// 年龄/性别比例
const SexAgeRatio = resolve => require(['./components/SexAgeRatio'], resolve)
// 各分店到店性别比例
const StoreSexRatio = resolve => require(['./components/StoreSexRatio'], resolve)
// 总客流周高峰时段
const RushHour = resolve => require(['./components/RushHour'], resolve)
// 门店当天客流高峰时段
const StoreRushHour = resolve => require(['./components/StoreRushHour'], resolve)
// 门店客流top10
const Top10 = resolve => require(['./components/Top10'], resolve)
const StoreAge = resolve => require(['./components/StoreAge'], resolve)
const StorePassengerFlow = resolve => require(['./components/StorePassengerFlow'], resolve)
const StoreWeek = resolve => require(['./components/StoreWeek'], resolve)
const AllRatio = resolve => require(['./components/AllRatio'], resolve)
const AllSexRatio = resolve => require(['./components/AllSexRatio'], resolve)
const AllRatioWeek = resolve => require(['./components/AllRatioWeek'], resolve)
const AllAgeRatio = resolve => require(['./components/AllAgeRatio'], resolve)
const VolumeWeekDayReport = resolve => require(['./components/VolumeWeekDayReport'], resolve)

// 登录
const Login = resolve => require(['./views/Login'], resolve)
const Layout = resolve => require(['./views/Layout'], resolve)

export default new Router({
  routes: [
    {
      path: "/",
      name: "layout",
      component: Layout,
      redirect: { name: 'home' },
      children: [
        {
          path: "/home",
          name: "home",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: Home
        },
        {
          path: "/top10",
          name: "top10",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: Top10
        },
        {
          path: "/sexAgeRatio",
          name: "sexAgeRatio",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: SexAgeRatio
        },
        {
          path: "/storeSexRatio",
          name: "storeSexRatio",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: StoreSexRatio
        },
        {
          path: "/storeAge",
          name: "storeAge",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: StoreAge
        },
        {
          path: "/rushHour",
          name: "rushHour",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: RushHour
        },
        {
          path: "/storeRushHour",
          name: "storeRushHour",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: StoreRushHour
        },
        {
          path: "/storePassengerFlow",
          name: "storePassengerFlow",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: StorePassengerFlow
        },
        {
          path: "/storeWeek",
          name: "storeWeek",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: StoreWeek
        },
        {
          path: "/allRatio",
          name: "allRatio",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: AllRatio
        },
        {
          path: "/allSexRatio",
          name: "allSexRatio",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: AllSexRatio
        },
        {
          path: "/allAgeRatio",
          name: "allAgeRatio",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: AllAgeRatio
        },
        {
          path: "/allRatioWeek",
          name: "allRatioWeek",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: AllRatioWeek
        },
        {
          path: "/volumeWeekDayReport",
          name: "volumeWeekDayReport",
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
          component: VolumeWeekDayReport
        }
      ]
    },
    {
      path: "/login",
      name: "login",
      component: Login
    }
  ]
});
